<?php
// $Id: editview.views_convert.inc,v 1.1 2009/02/17 00:39:02 agileware Exp $

/**
 * @file
 * Style conversion for editable node views.
 */

/**
 * Implementation of hook_views_convert().
 */
function editview_location_views_convert($display, $type, &$view, $field) {
  static $displays = array();
  if ($type == 'style') {
    switch ($field) {
      case 'editview_table':
      case 'editview_compressed':
        $displays[] = $display;
        $handler = &$view->display[$display]->handler;
        $handler->set_option('style_plugin', 'editview_location');
        break;
    }
  }
  elseif ($type == 'filter' && $field['field'] == 'type') {
    foreach ($displays as $display) {
      $handler = &$view->display[$display]->handler;
      $handler->set_option('style_options', array(
        'editview_location_type' => array_shift($field['value']),
        'editview_location_position' => EDITVIEW_ABOVE,
      ));
    }
  }
}
